package org.xbs.demo1.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.xbs.demo1.mapper.DeptMapper;
import org.xbs.demo1.pojo.Dept;
import org.xbs.demo1.pojo.User;
import org.xbs.demo1.service.IDeptService;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class DeptService implements IDeptService {
    @Autowired
    private DeptMapper deptMapper;
    @Override
    public List<Dept> getDepts(){
        return deptMapper.getDepts();
    }
    @Override
    public void deleteDeptsById(Integer id){
        deptMapper.deleteDeptsById(id);
    }
    @Override
    public void addDepts(Dept dept){
        dept.setUpdateTime(LocalDateTime.now());
        dept.setCreateTime(LocalDateTime.now());
        deptMapper.addDepts(dept);
    }
    @Override
    public Dept getDeptsById(Integer id){
        return deptMapper.getDeptsById(id);
    }
    @Override
    public void updateDepts(Dept dept){
        dept.setUpdateTime(LocalDateTime.now());
        deptMapper.updateDeptsById(dept);
    }

}
